//
//  HJAskToBuyCell.m
//  Sneakers
//
//  Created by 胡光健 on 2017/9/25.
//  Copyright © 2017年 mac. All rights reserved.
//

#import "HJAskToBuyCell.h"
#import "HJMineModel.h"

@interface HJAskToBuyCell()
@property (weak, nonatomic) IBOutlet UIImageView *mianImage;
@property (weak, nonatomic) IBOutlet UILabel *title;
@property (weak, nonatomic) IBOutlet UILabel *price;// 价格
@property (weak, nonatomic) IBOutlet UILabel *staute;// 状态

@property (weak, nonatomic) IBOutlet UILabel *code;// 码
@property (weak, nonatomic) IBOutlet UILabel *percent;// 百分比
@property (weak, nonatomic) IBOutlet UIImageView *rank;// 排序
@property (weak, nonatomic) IBOutlet UILabel *time1;
@property (weak, nonatomic) IBOutlet UILabel *timestatue;
@property (weak, nonatomic) IBOutlet UIButton *btmBtn;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *btmH;
@end
@implementation HJAskToBuyCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    self.timestatue.font =HJFontSize(mScreenWidth/414 * 13);
    self.time1.font =HJFontSize(mScreenWidth/414 * 13);
    self.code.font =HJFontSize(mScreenWidth/414 * 13);
    self.title.font =HJFontSize(mScreenWidth/414 * 15);
    self.percent.font =HJFontSize(mScreenWidth/414 * 15);
    self.price.font =HJFontSize(mScreenWidth/414 * 19);
    self.staute.font =HJFontSize(mScreenWidth/414 * 9);
    self.btmBtn.layer.borderWidth = 0.5;
    self.btmBtn.layer.borderColor = HJColorRGB(51).CGColor;
    self.btmBtn.layer.cornerRadius = 16;
    self.btmBtn.layer.masksToBounds = YES;
}


-(void)setSellModel:(HJSellModel *)sellModel {
    _sellModel = sellModel;
    [self.mianImage sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@/%@",sellModel.avatar_base_url,sellModel.avatar_path]]];
    self.title.text = sellModel.shoes_name;
    self.code.text = [NSString stringWithFormat:@"%@码",sellModel.shoes_size];
    self.price.text = [NSString stringWithFormat:@"￥%@",sellModel.percent];
    
    self.staute.text = @"出售价";
    self.time1.text = sellModel.created_at;
    
    if ([sellModel.state2 isEqual:@0]) {
        self.percent.textColor = HJColor(255, 72, 74);
        self.rank.image = HJImage(@"Fill 7");
    }else {
        self.percent.textColor = HJColor(71, 201, 157);
        self.rank.image = HJImage(@"Fill 1 Copy 00");
    }
    
    if ([sellModel.percent isEqualToString:@"0.00"]) {
        self.percent.text = @"";
        self.rank.hidden = YES;
    }else {
        self.percent.text = [NSString stringWithFormat:@"%@%%",sellModel.percent];
    }
    self.timestatue.text = sellModel.refund;
    
//    请于2017/9/12 24:00前寄出您的商品
    if ([sellModel.is_false isEqual:@1]) {
        self.btmH.constant = 60.0f;
        self.btmBtn.hidden = NO;
    }else {
        self.btmH.constant = 0.0f;
//        self.timestatue.hidden = YES;
        self.btmBtn.hidden = YES;
    }
    
}
- (IBAction)enteringBtn:(UIButton *)sender {
    [mNotificationCenter postNotificationName:@"inputNumberNotification" object:nil userInfo:@{@"sell_id":_sellModel.sell_id}];
    
}

@end
